<?php

/**
 * @copyright       : FOSP
 * @version         : 20120409
 * @todo            : Match Extend format
 * @name            : MatchExtend
 * @author          : TrongNV
 */
class Fpt_Business_MatchExtend_Metadata_MatchExtend {

    /**
     *
     * @var int
     */
    private $_matchId;

    /**
     *
     * @var string
     */
    private $_imageTeam1;

    /**
     *
     * @var string
     */
    private $_imageTeam2;

    /**
     *
     * @var int
     */
    private $_goalTeam1;

    /**
     *
     * @var int
     */
    private $_goalTeam2;

    /**
     *
     * @var string
     */
    private $_infoTeam1;

    /**
     *
     * @var string
     */
    private $_infoTeam2;

    /**
     *
     * @var string
     */
    private $_matchInfo;

    /**
     *
     * @var string
     */
    private $_matchHistory;

    /**
     *
     * @var string
     */
    private $_matchSquad;

    /**
     *
     * @var string
     */
    private $_leftPerformance;

    /**
     *
     * @var string
     */
    private $_rightPerformance;

    /**
     *
     * @var string
     */
    private $_playerStar;

    /**
     *
     * @var string
     */
    private $_leftSquad;

    /**
     *
     * @var string
     */
    private $_rightSquad;

    /**
     *
     * @var string
     */
    private $_leftSuspend;

    /**
     *
     * @var string
     */
    private $_rightSuspend;

    /**
     *
     * @var int
     */
    private $_creationTime;

    /**
     *
     * @var int
     */
    private $_updateTime;

    /**
     *
     * @var string
     */
    private $_matchcode;

    /**
     *
     * @var int
     */
    private $_status;

    /**
     *
     * @var string
     */
    private $_imageBackground;

    /**
     *
     * @var string
     */
    private $_description;

    /**
     *
     * @var string
     */
    private $_title;

    /**
     *
     * @var string
     */
    private $_keyword;

    /**
     *
     * @var string
     */
    private $_facebookLink;

    public function __construct() {
        $this->_matchId = 0;
        $this->_imageTeam1 = '';
        $this->_imageTeam2 = '';
        $this->_goalTeam1 = '';
        $this->_goalTeam2 = '';
        $this->_infoTeam1 = '';
        $this->_infoTeam2 = '';
        $this->_matchInfo = '';
        $this->_matchHistory = '';
        $this->_matchSquad = '';
        $this->_leftPerformance = '';
        $this->_playerStar = '';
        $this->_leftSquad = '';
        $this->_rightSquad = '';
        $this->_leftSuspend = '';
        $this->_rightSuspend = '';
        $this->_updateTime = 0;
        $this->_rightPerformance = '';
        $this->_matchcode = '';
        $this->_status = 0;
        $this->_imageBackground = '';
        $this->_description = '';
        $this->_title = '';
        $this->_keyword = '';
        $this->_facebookLink = '';
    }

    public function __destruct() {
        unset($this->_matchId, $this->_imageTeam1, $this->_imageTeam2, $this->_goalTeam1, $this->_goalTeam1, $this->_infoTeam1, $this->_InfoTeam2, $this->_matchInfo, $this->_matchHistory, $this->_matchSquad, $this->_leftPerformance, $this->_playerStar, $this->_rightPerformance, $this->_leftSquad, $this->_rightSquad, $this->_leftSuspend, $this->_rightSuspend, $this->_updateTime, $this->_matchcode, $this->_status, $this->_imageBackground, $this->_description, $this->_title, $this->_keyword, $this->_facebookLink);
    }

    /**
     * Initialize data
     * @param array $entity
     * @return MatchExtend 
     */
    public function init($entity) {
        $this->_matchId      = intval($entity['match_id']);
        $this->_creationTime = intval($entity['creation_time']);
        $this->_imageTeam1   = !isset($entity['image_team1']) ? NULL : $entity['image_team1'];
        $this->_imageTeam2   = !isset($entity['image_team2']) ? NULL : $entity['image_team2'];
        $this->_goalTeam1    = !isset($entity['goal_team1']) ? NULL : $entity['goal_team1'];
        $this->_goalTeam2    = !isset($entity['goal_team2']) ? NULL : $entity['goal_team2'];
        $this->_infoTeam1    = !isset($entity['info_team1']) ? NULL : $entity['info_team1'];
        $this->_infoTeam2    = !isset($entity['info_team2']) ? NULL : $entity['info_team2'];
        $this->_matchInfo    = !isset($entity['match_info']) ? NULL : $entity['match_info'];
        $this->_matchHistory = !isset($entity['match_history']) ? NULL : $entity['match_history'];
        $this->_matchSquad   = !isset($entity['match_squad']) ? NULL : $entity['match_squad'];
        $this->_leftPerformance = !isset($entity['left_performance']) ? NULL : $entity['left_performance'];
        $this->_playerStar   = !isset($entity['player_star']) ? NULL : $entity['player_star'];
        $this->_rightPerformance = !isset($entity['right_performance']) ? NULL : $entity['right_performance'];
        $this->_leftSquad    = !isset($entity['left_squad']) ? NULL : $entity['left_squad'];
        $this->_rightSquad   = !isset($entity['right_squad']) ? NULL : $entity['right_squad'];
        $this->_leftSuspend  = !isset($entity['left_suspend']) ? NULL : $entity['left_suspend'];
        $this->_rightSuspend = !isset($entity['right_suspend']) ? NULL : $entity['right_suspend'];
        $this->_matchcode    = !isset($entity['match_code']) ? NULL : $entity['match_code'];
        $this->_updateTime   = intval($entity['update_time']);
        $this->_status       = intval($entity['status']);
        $this->_imageBackground = !isset($entity['image_background']) ? NULL : $entity['image_background'];
        $this->_description  = !isset($entity['description']) ? NULL : $entity['description'];
        $this->_title        = !isset($entity['title']) ? NULL : $entity['title'];
        $this->_keyword      = !isset($entity['keyword']) ? NULL : $entity['keyword'];
        $this->_facebookLink = !isset($entity['facebook_link']) ? NULL : $entity['facebook_link'];
        return $this;
    }

    /**
     * Get formated data
     * @return array
     * @author TrongNV
     */
    public function getFormatedData() {
        return array(
            'MatchID'           => $this->_matchId,
            'ImageTeam1'        => $this->_imageTeam1,
            'ImageTeam2'        => $this->_imageTeam2,
            'GoalTeam1'         => $this->_goalTeam1,
            'GoalTeam2'         => $this->_goalTeam2,
            'InfoTeam1'         => $this->_infoTeam1,
            'InfoTeam2'         => $this->_infoTeam2,
            'MatchInfo'         => $this->_matchInfo,
            'MatchHistory'      => $this->_matchHistory,
            'MatchSquad'        => $this->_matchSquad,
            'LeftPerformance'   => $this->_leftPerformance,
            'PlayerStar'        => $this->_playerStar,
            'RightPerformance'  => $this->_rightPerformance,
            'LeftSquad'         => $this->_leftSquad,
            'RightSquad'        => $this->_rightSquad,
            'LeftSuspend'       => $this->_leftSuspend,
            'RightSuspend'      => $this->_rightSuspend,
            'MatchCode'         => $this->_matchcode,
            'UpdateTime'        => $this->_updateTime,
            'Status'            => $this->_status,
            'ImageBackground'   => $this->_imageBackground,
            'Description'       => $this->_description,
            'Title'             => $this->_title,
            'Keyword'           => $this->_keyword,
            'FacebookLink'      => $this->_facebookLink,
        );
    }

}